<?php

namespace App\Remote\WhoBot;

use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpFoundation\Request as RequestAlias;

class ChatRemote extends Remote
{
    /**
     * 发消息
     *
     * @param string $userId
     * @param string $messageId
     * @param string $sessionId
     * @param string $requestSource
     * @param array $message
     * @return mixed
     * @throws GuzzleException
     * @throws ValidationException
     */
    public static function sendChat(
        string $userId,
        string $messageId,
        string $sessionId,
        string $requestSource,
        array $message
    ) {
        return self::customRequestV3(
            "/customer/ai/im",
            RequestAlias::METHOD_POST,
            [
                "user_id"        => $userId,
                "message_id"     => $messageId,
                "session_id"     => $sessionId,
                "request_source" => $requestSource,
                "message"        => $message
            ], null, null, 1, true
        );
    }
}
